/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.kj.order.entity;

import com.jeesite.modules.sys.entity.Company;
import com.jeesite.modules.sys.entity.Office;
import org.hibernate.validator.constraints.Length;
import java.util.Date;
import java.util.List;

import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
import com.fasterxml.jackson.annotation.JsonFormat;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;

/**
 * orderEntity
 * @author hzy
 * @version 2019-11-29
 */
@Table(name="kj_order", alias="a", columns={
		@Column(name="order_id", attrName="orderId", label="订单号", isPK=true),
		@Column(name="payment", attrName="payment", label="实付金额", comment="实付金额(元)", isQuery=false),
		@Column(name="payment_type", attrName="paymentType", label="支付类型"),
		@Column(name="post_fee", attrName="postFee", label="邮费", isQuery=false),
		@Column(includeEntity=DataEntity.class),
		@Column(name="payment_time", attrName="paymentTime", label="付款时间", isQuery=false),
		@Column(name="consign_time", attrName="consignTime", label="发货时间", isQuery=false),
		@Column(name="end_time", attrName="endTime", label="订单结束时间", isQuery=false),
		@Column(name="close_time", attrName="closeTime", label="订单关闭时间", isQuery=false),
		@Column(name="shipping_name", attrName="shippingName", label="物流名称", isQuery=false),
		@Column(name="shipping_code", attrName="shippingCode", label="物流单号", isQuery=false),
		@Column(name="user_id", attrName="userId", label="用户id", isQuery=false),
		@Column(name="buyer_message", attrName="buyerMessage", label="买家留言", isQuery=false),
		@Column(name="buyer_nick", attrName="buyerNick", label="买家昵称", isQuery=false),
		@Column(name="buyer_rate", attrName="buyerRate", label="订单评价", isQuery=false),
	}, joinTable={
		@JoinTable(type=JoinTable.Type.LEFT_JOIN, entity=KjOrderItem.class, alias="i",
				on="i.order_id = a.order_id",
				columns={@Column(includeEntity=KjOrderItem.class)}),
		@JoinTable(type=JoinTable.Type.LEFT_JOIN, entity=KjOrderShipping.class, alias="s",
				on="s.order_id = a.order_id",
				columns={@Column(includeEntity=KjOrderShipping.class)}),

}, orderBy="a.update_date DESC"
)
public class Order extends DataEntity<Order> {
	
	private static final long serialVersionUID = 1L;
	private String orderId;		// 订单号
	private String payment;		// 实付金额(元)
	private Integer paymentType;		// 支付类型
	private String postFee;		// 邮费
	private Date paymentTime;		// 付款时间
	private Date consignTime;		// 发货时间
	private Date endTime;		// 订单结束时间
	private Date closeTime;		// 订单关闭时间
	private String shippingName;		// 物流名称
	private String shippingCode;		// 物流单号
	private String userId;		// 用户id
	private String buyerMessage;		// 买家留言
	private String buyerNick;		// 买家昵称
	private Double buyerRate;		// 订单评价

	private List<KjOrderItem> kjOrderItemList;
	private List<KjOrderShipping> kjOrderShippingList;
	
	public Order() {
		this(null);
	}

	public Order(String id){
		super(id);
	}
	
	public String getOrderId() {
		return orderId;
	}

	public void setOrderId(String orderId) {
		this.orderId = orderId;
	}
	
	@Length(min=0, max=50, message="实付金额长度不能超过 50 个字符")
	public String getPayment() {
		return payment;
	}

	public void setPayment(String payment) {
		this.payment = payment;
	}
	
	public Integer getPaymentType() {
		return paymentType;
	}

	public void setPaymentType(Integer paymentType) {
		this.paymentType = paymentType;
	}
	
	@Length(min=0, max=50, message="邮费长度不能超过 50 个字符")
	public String getPostFee() {
		return postFee;
	}

	public void setPostFee(String postFee) {
		this.postFee = postFee;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getPaymentTime() {
		return paymentTime;
	}

	public void setPaymentTime(Date paymentTime) {
		this.paymentTime = paymentTime;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getConsignTime() {
		return consignTime;
	}

	public void setConsignTime(Date consignTime) {
		this.consignTime = consignTime;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getCloseTime() {
		return closeTime;
	}

	public void setCloseTime(Date closeTime) {
		this.closeTime = closeTime;
	}
	
	@Length(min=0, max=255, message="物流名称长度不能超过 255 个字符")
	public String getShippingName() {
		return shippingName;
	}

	public void setShippingName(String shippingName) {
		this.shippingName = shippingName;
	}
	
	@Length(min=0, max=255, message="物流单号长度不能超过 255 个字符")
	public String getShippingCode() {
		return shippingCode;
	}

	public void setShippingCode(String shippingCode) {
		this.shippingCode = shippingCode;
	}
	
	@Length(min=0, max=64, message="用户id长度不能超过 64 个字符")
	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}
	
	@Length(min=0, max=255, message="买家留言长度不能超过 255 个字符")
	public String getBuyerMessage() {
		return buyerMessage;
	}

	public void setBuyerMessage(String buyerMessage) {
		this.buyerMessage = buyerMessage;
	}
	
	@Length(min=0, max=255, message="买家昵称长度不能超过 255 个字符")
	public String getBuyerNick() {
		return buyerNick;
	}

	public void setBuyerNick(String buyerNick) {
		this.buyerNick = buyerNick;
	}
	
	public Double getBuyerRate() {
		return buyerRate;
	}

	public void setBuyerRate(Double buyerRate) {
		this.buyerRate = buyerRate;
	}

	public List<KjOrderItem> getKjOrderItemList() {
		return kjOrderItemList;
	}

	public void setKjOrderItemList(List<KjOrderItem> kjOrderItemList) {
		this.kjOrderItemList = kjOrderItemList;
	}

	public List<KjOrderShipping> getKjOrderShippingList() {
		return kjOrderShippingList;
	}

	public void setKjOrderShippingList(List<KjOrderShipping> kjOrderShippingList) {
		this.kjOrderShippingList = kjOrderShippingList;
	}
}